package com.gao.handle;

import java.util.Scanner;

/**
 * @Author: ShanYuqing
 * @Version: v1.0
 */
public class HandleTest {
    /*
            输入学生的姓名和年龄
     */
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String name = sc.nextLine();
        Student student = new Student();
        student.setName(name);
        try {
            int age = Integer.parseInt(sc.nextLine());
            student.setAge(age);
        } catch (NumberFormatException e) {
            System.out.println("不是数字");
        }catch(Exception e){
            System.out.println(e.getMessage());
        }
        System.out.println(student);
    }
}
